//
//  CTHomePageView.m
//  ConstellationTalk_0.1
//
//  Created by riley on 15/6/5.
//  Copyright (c) 2015年 riley chu. All rights reserved.
//

#import "CTHomePageView.h"
#import "CTDebugManager.h"
#import "CTHeader.h"
#import "CTHomePageItems.h"
#import "CTDeviceFunction.h"
#import "CTLogin.h"
#import "CTHomePageTableView.h"
#import "CTHotSpotCell.h"
#import "CTAppLanguage.h"


@interface CTHomePageView ()<CTHomePageTableViewDelegate,UIScrollViewDelegate>
{
    UIView * topView;
   
    
    UIScrollView * classficationScrollView;
    UIScrollView * themeScrollView;

    
    CTHomePageTableView * currentSelectedTableView;
    
    
    
    CGRect hotSpotCellFrameFirst;
    CGRect hotSpotCellFrameSecond;
    CGRect hotSpotCellFrameLast;
    CGRect hotSpotCellFrameSecondLast;
    
}

@end


@implementation CTHomePageView
@synthesize delegate,currentSlelectedClassificationItem;

- (void)dealloc
{
    [topView removeFromSuperview];
    topView = nil;
    
    [classficationScrollView removeFromSuperview];
    classficationScrollView = nil;
    
    [themeScrollView removeFromSuperview];
    themeScrollView = nil;

    
    delegate = nil;
    currentSlelectedClassificationItem = nil;
    
    currentSelectedTableView = nil;
    
    [CTDebugManager showDebugLogInfo:@"dealloc : CTHomePageView Is Removed!!!"];
}

- (instancetype)initWithType:(CTHomePageViewType)type
{
    self = [super init];
    if (self) {
        
        self.frame = CGRectMake(0, 0, CT_HEADER_SCREEN_WIDTH, CT_HEADER_SCREEN_HEIGHT);
        self.backgroundColor = CT_HEADER_WHITE_COLOR;
        
        
        [self creatSubviews];
        if (type == CTHomePageViewTypeDefault) {
            [self creatClassificationInfoView];
            [self creatThemeInfoView];
        }else{
            [self creatNoDataView];
        }
        
    }
    return self;
}


-(void)creatSubviews
{
    
    topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CT_HEADER_SCREEN_WIDTH, 64)];
    topView.backgroundColor = CT_HEADER_WHITE_COLOR;
    [self addSubview:topView];
    UIImageView * titleLogo = [[UIImageView alloc] initWithFrame:CGRectMake((CT_HEADER_SCREEN_WIDTH - 97)/2.0, 31,97, 19)];
    titleLogo.image = [UIImage imageNamed:@"logo"];
    [topView addSubview:titleLogo];
    
    UIView * topLineView = [[UIView alloc] initWithFrame:CGRectMake(0,63.5, CT_HEADER_SCREEN_WIDTH, 0.5)];
    topLineView.backgroundColor = [UIColor colorWithRed:164/255.0 green:164/255.0 blue:164/255.0 alpha:1.0];
    [topView addSubview:topLineView];
    
}


-(void)creatClassificationInfoView
{
    UIView * classificationView = [[UIView alloc] initWithFrame:CGRectMake(0, 64, CT_HEADER_SCREEN_WIDTH, 40)];
    classificationView.backgroundColor = [UIColor clearColor];
    [self addSubview:classificationView];
    
    UIView * classificationLineView = [[UIView alloc] initWithFrame:CGRectMake(0,39.5, CT_HEADER_SCREEN_WIDTH, 0.5)];
    classificationLineView.backgroundColor = [UIColor colorWithRed:164/255.0 green:164/255.0 blue:164/255.0 alpha:1.0];
    [classificationView addSubview:classificationLineView];
    
    
    classficationScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0,CT_HEADER_SCREEN_WIDTH, 40)];
    classficationScrollView.backgroundColor = [UIColor clearColor];
    classficationScrollView.showsHorizontalScrollIndicator = NO;
    classficationScrollView.showsVerticalScrollIndicator = NO;
    [classificationView addSubview:classficationScrollView];
    
}


-(void)creatThemeInfoView
{
    themeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,104, CT_HEADER_SCREEN_WIDTH, CT_HEADER_SCREEN_HEIGHT-114-40)];
    themeScrollView.backgroundColor = [UIColor clearColor];
    themeScrollView.pagingEnabled = YES;
    themeScrollView.delegate = self;
    themeScrollView.showsHorizontalScrollIndicator = NO;
    themeScrollView.showsVerticalScrollIndicator = NO;
    [self addSubview:themeScrollView];
}

-(void)creatNoDataView
{
    
    UIView * backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CT_HEADER_SCREEN_WIDTH, 184)];
    backgroundView.backgroundColor = [UIColor clearColor];
    backgroundView.center = self.center;
    [self addSubview:backgroundView];
    
    UIImageView * notLoginInImageView = [[UIImageView alloc] initWithFrame:CGRectMake((CT_HEADER_SCREEN_WIDTH - 90.5)/2.0, 0, 90.5, 108)];
    notLoginInImageView.image = [UIImage imageNamed:@"wuneirong"];
    [backgroundView addSubview:notLoginInImageView];
    
    UILabel * remindLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,notLoginInImageView.frame.size.height + 15.0, CT_HEADER_SCREEN_WIDTH, 18.0)];
    remindLabel.textAlignment = NSTextAlignmentCenter;
    remindLabel.font = [UIFont systemFontOfSize:18.0];
    remindLabel.text = [CTAppLanguage localizedStringForKey:@"CTHomePageViewController_Request_Failed" withValue:nil withTable:@"Language"];
    remindLabel.textColor = [UIColor colorWithRed:164/255.0 green:164/255.0 blue:164/255.0 alpha:1.0];
    [backgroundView addSubview:remindLabel];
    
    UIButton * loginBtn =[UIButton buttonWithType:UIButtonTypeCustom];
    loginBtn.frame = CGRectMake((CT_HEADER_SCREEN_WIDTH - 80)/2.0,notLoginInImageView.frame.size.height + remindLabel.frame.size.height + 5.0+20.0,80,28);
    [loginBtn addTarget:self action:@selector(reloadViewBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    loginBtn.layer.borderWidth = 1;
    loginBtn.layer.cornerRadius = 3;
    loginBtn.layer.masksToBounds = YES;
    loginBtn.layer.borderColor = CT_HEADER_GREEN_COLOR.CGColor;
    [loginBtn setTitleColor:CT_HEADER_GREEN_COLOR forState:UIControlStateNormal];
    [loginBtn setTitle:[CTAppLanguage localizedStringForKey:@"CTHomePageViewController_Request_Reload" withValue:nil withTable:@"Language"] forState:UIControlStateNormal];
    loginBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
    [backgroundView addSubview:loginBtn];
    
    
}





#pragma mark - action delegate -

-(void)selectCurretGroup:(CTTopic *)item
{
    NSArray * subViewsArr = [classficationScrollView subviews];
    
    for (CTHotSpotCell * cell in subViewsArr) {
        if ([item.group_id isEqualToString:cell.item.group_id]) {
            
            [self reloadClassificationView];
            cell.LabelColor = CT_HEADER_GREEN_COLOR;
            
     
            //设置当前分类列表scrollview的offset
            if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH) {
                if (cell.tag == 0) {
                    [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
                }else if (cell.tag == 1){
                    [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
                }else if (cell.tag == [classficationScrollView subviews].count-1){
                    [classficationScrollView setContentOffset:CGPointMake((classficationScrollView.contentSize.width-CT_HEADER_SCREEN_WIDTH),0)];
                }else{
                    [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];
                }
            }
//            //设置当前分类列表scrollview的offset
//            if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH && cell.tag != 0 && cell.tag != 1 && cell.tag != [classficationScrollView subviews].count-1 )
//                [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];
            
            [themeScrollView setContentOffset:CGPointMake(cell.tag * CT_HEADER_SCREEN_WIDTH, 0)];
            
            currentSlelectedClassificationItem = cell.item;
            currentSelectedTableView = (CTHomePageTableView *)[[themeScrollView subviews] objectAtIndex:cell.tag];
            
            if ([self.delegate respondsToSelector:@selector(classificationAction:withItem:)]) {
                [self.delegate classificationAction:self withItem:cell.item];
            }
            
            break;
        }
    }
}


-(void)classificationBtnAction:(id)sender
{
    [self reloadClassificationView];
    
    UITapGestureRecognizer * singleRecognizer = (UITapGestureRecognizer *)sender;
    CTHotSpotCell * cell = (CTHotSpotCell*)singleRecognizer.view;
    cell.LabelColor = CT_HEADER_GREEN_COLOR;
    
    
    
    //设置当前分类列表scrollview的offset
    if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH) {
        if (cell.tag == 0) {
            [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
        }else if (cell.tag == 1){
            [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
        }else if (cell.tag == [classficationScrollView subviews].count-1){
            [classficationScrollView setContentOffset:CGPointMake((classficationScrollView.contentSize.width-CT_HEADER_SCREEN_WIDTH),0)];
        }else{
            [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];
        }
    }
//    //设置当前分类列表scrollview的offset
//    if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH && cell.tag != 0 && cell.tag != 1 && cell.tag != [classficationScrollView subviews].count-1 )
//        [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];
   
    [themeScrollView setContentOffset:CGPointMake(cell.tag * CT_HEADER_SCREEN_WIDTH, 0)];
    
    currentSlelectedClassificationItem = cell.item;
    currentSelectedTableView = (CTHomePageTableView *)[[themeScrollView subviews] objectAtIndex:cell.tag];
    
    if ([self.delegate respondsToSelector:@selector(classificationAction:withItem:)]) {
        [self.delegate classificationAction:self withItem:cell.item];
    }
}

-(void)reloadViewBtnAction:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(reloadViewAction:)]) {
        [self.delegate reloadViewAction:self];
    }
}


#pragma mark - setter -

-(void)setThemeListArr:(NSArray *)themeListArray
{
    NSArray * themeListViewsArr = [themeScrollView subviews];
    if (themeListViewsArr.count != 0) {
        if (currentSlelectedClassificationItem != nil) {
            for (int i = 0;i<themeListViewsArr.count;i++) {
                CTHomePageTableView * homePageTableView = [themeListViewsArr objectAtIndex:i];
                if ([currentSlelectedClassificationItem.group_id isEqualToString:homePageTableView.item.group_id]) {
                  //  homePageTableView.infoArray = themeListArray;
                    [themeScrollView setContentOffset:CGPointMake(i*CT_HEADER_SCREEN_WIDTH, 0)];
                    break;
                }
            }
        }
    }
}

-(void)setClassificationInfoArr:(NSArray *)classficationArray
{
    if (classficationArray.count == 0){
        [CTDebugManager showDebugLogInfo:@"当前没有分类数据信息!"];
        return;
    }
    
    //reload theme view
    [self reloadThemeInfoView:classficationArray];
    
    
    classficationScrollView.contentSize = CGSizeMake(2000, 0);
    float  scrollContentWidth = 10;
    NSInteger arrayCount = classficationArray.count;
    for (int i = 0; i < classficationArray.count; i++) {
        
        CTHotSpotsItem * item = [classficationArray objectAtIndex:i];
        
        CGSize size = CGSizeMake(150,0);
        UIFont * font = [UIFont systemFontOfSize:19];
        CGSize labelsize = [item.hotspot_name sizeWithFont:font constrainedToSize:size];
        CTHotSpotCell * hotSpotCell = [[CTHotSpotCell alloc] initWithFrame:CGRectMake(i*15+scrollContentWidth,0, labelsize.width, 40)];
        hotSpotCell.tag = i;
        hotSpotCell.LabelText = item.hotspot_name;
        hotSpotCell.item = item;
        if (i == 0) {
            hotSpotCell.LabelColor = CT_HEADER_GREEN_COLOR;
            
            //给controller回调
            if ([self.delegate respondsToSelector:@selector(classificationAction:withItem:)]) {
                [self.delegate classificationAction:self withItem:hotSpotCell.item];
            }
        }
        else
        {
            hotSpotCell.LabelColor = [UIColor colorWithRed:164/255.0 green:164/255.0 blue:164/255.0 alpha:1.0];
        }
        scrollContentWidth  += labelsize.width;
        [classficationScrollView addSubview:hotSpotCell];
        
        
        if (i == 0) {
            hotSpotCellFrameFirst = hotSpotCell.frame;
        }else if (i == 1){
            hotSpotCellFrameSecond = hotSpotCell.frame;
        }else if (i == arrayCount-1){
            hotSpotCellFrameLast = hotSpotCell.frame;
        }else if (i == arrayCount-2){
            hotSpotCellFrameSecondLast = hotSpotCell.frame;
        }
        
        
        
        UITapGestureRecognizer * singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(classificationBtnAction:)];
        singleRecognizer.numberOfTapsRequired = 1;
        [hotSpotCell addGestureRecognizer:singleRecognizer];
    }
    
    classficationScrollView.contentSize = CGSizeMake(scrollContentWidth+classficationArray.count*15, 0);
    
}

-(void)setHotSpotsDetailArr:(NSArray *)hotSpotsDetailArray
{
    currentSelectedTableView.currentHotSpotsItem = currentSlelectedClassificationItem;
    currentSelectedTableView.infoArray = hotSpotsDetailArray;
    [self reloadData];
}

-(void)setSubjectItem:(CTSubjectItem *)subjectItem
{
    currentSelectedTableView.subjItem = subjectItem;
    [self reloadData];
}


#pragma mark - reload view -

-(void)reloadClassificationView
{
    NSArray * viewsArray = [classficationScrollView subviews];
    
    for (CTHotSpotCell * cell in viewsArray) {
        cell.LabelColor = [UIColor colorWithRed:164/255.0 green:164/255.0 blue:164/255.0 alpha:1.0];
    }
}

-(void)reloadThemeInfoView:(NSArray *)arr
{
    themeScrollView.contentSize = CGSizeMake(arr.count*CT_HEADER_SCREEN_WIDTH, 0);
    
    for (int i = 0; i < arr.count; i ++) {
        
        CTHotSpotsItem * item = [arr objectAtIndex:i];
        
        CTHomePageTableView* homePageTableView = [[CTHomePageTableView alloc] initWithFrame:CGRectMake(i*CT_HEADER_SCREEN_WIDTH, 0, CT_HEADER_SCREEN_WIDTH, themeScrollView.frame.size.height)];
        homePageTableView.item = item;
        homePageTableView.tag = i;
        homePageTableView.delegate = self;
        [themeScrollView addSubview:homePageTableView];
        
        if (i == 0) {
            currentSelectedTableView = homePageTableView;
        }
    }
}


#pragma mark - scroll delegate -

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    //获取当前分类字体所对应的主题列表视图的索引
    int contentViewIndex = scrollView.contentOffset.x/CT_HEADER_SCREEN_WIDTH;
   
    
    //修改分类列表字体颜色
    [self reloadClassificationView];
    CTHotSpotCell * cell = (CTHotSpotCell *)[[classficationScrollView subviews] objectAtIndex:contentViewIndex];
    cell.LabelColor = CT_HEADER_GREEN_COLOR;
    
    
    //设置当前分类列表scrollview的offset
    if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH) {
        if (cell.tag == 0) {
            [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
        }else if (cell.tag == 1){
            [classficationScrollView setContentOffset:CGPointMake(hotSpotCellFrameFirst.origin.x,0)];
        }else if (cell.tag == [classficationScrollView subviews].count-1){
            [classficationScrollView setContentOffset:CGPointMake((classficationScrollView.contentSize.width-CT_HEADER_SCREEN_WIDTH),0)];
        }else{
           [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];
        }
    }
//    if (classficationScrollView.contentSize.width >= CT_HEADER_SCREEN_WIDTH && cell.tag != 0 && cell.tag != 1 && cell.tag != [classficationScrollView subviews].count-1)
//        [classficationScrollView setContentOffset:CGPointMake(cell.frame.origin.x-(CT_HEADER_SCREEN_WIDTH - cell.frame.size.width)/2.0, 0)];

 
    
    //赋值给当前的全局分类item
    currentSlelectedClassificationItem = cell.item;
    currentSelectedTableView = (CTHomePageTableView *)[[themeScrollView subviews] objectAtIndex:contentViewIndex];
    
    //给controller回调
    if ([self.delegate respondsToSelector:@selector(classificationAction:withItem:)]) {
        [self.delegate classificationAction:self withItem:cell.item];
    }
}







#pragma mark - action & delegate -

-(void)refresh
{
    [currentSelectedTableView refresh];
}

-(void)refreshPullDownEnd
{
    [currentSelectedTableView refreshPullDownEnd];
}
-(void)refreshPullUpEnd
{
    [currentSelectedTableView refreshPullUpEnd];
}

-(void)reloadData
{
    [currentSelectedTableView reloadData];
}





#pragma mark - home table view delegate -

-(void)refreshControlPullDown:(CTHomePageTableView *)view
{
    if ([self.delegate respondsToSelector:@selector(refreshPullDown:)]) {
        [self.delegate refreshPullDown:self];
    }
}

-(void)refreshControlPullUp:(CTHomePageTableView *)view
{
    if ([self.delegate respondsToSelector:@selector(refreshPullUp:)]) {
        [self.delegate refreshPullUp:self];
    }
}

//主题代理
-(void)subjectCheckAction:(CTHomePageTableView *)view
{
    if ([self.delegate respondsToSelector:@selector(checkAction:)]) {
        [self.delegate checkAction:self];
    }
}
-(void)subjectShareAction:(CTHomePageTableView *)view
{
    if ([self.delegate respondsToSelector:@selector(shareAction:)]) {
        [self.delegate shareAction:self];
    }
}

//cell代理
/**
 *@brief 点击评论总数
 */
- (void)homePageTableViewCommentCountAction:(CTHomePageTableView *)cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(commentCountAction:withItem:)]) {
        [self.delegate commentCountAction:self withItem:item];
    }
}
/**
 *@brief 点击评论第一条
 */
- (void)homePageTableViewCommentHitFirstLabelAction:(CTHomePageTableView *) cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(commentHitFirstLabelAction:withItem:)]) {
        [self.delegate commentHitFirstLabelAction:self withItem:item];
    }
}
/**
 *@brief 点击评论第二条
 */
- (void)homePageTableViewCommentHitSecondLabelAction:(CTHomePageTableView *) cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(commentHitSecondLabelAction:withItem:)]) {
        [self.delegate commentHitSecondLabelAction:self withItem:item];
    }
}
/**
 *@brief 点击评论第一条头像
 */
- (void)homePageTableViewCommentHitFirstHeadAction:(CTHomePageTableView *)cell withItem:(CTComment *) item
{
    if ([self.delegate respondsToSelector:@selector(commentHitFirstHeadAction:withItem:)]) {
        [self.delegate commentHitFirstHeadAction:self withItem:item];
    }
}
/**
 *@brief 点击评论第二条头像
 */
- (void)homePageTableViewCommentHitSecondHeadAction:(CTHomePageTableView *)cell withItem:(CTComment *)item
{
    if ([self.delegate respondsToSelector:@selector(commentHitSecondHeadAction:withItem:)]) {
        [self.delegate commentHitSecondHeadAction:self withItem:item];
    }
}
/**
 *@brief 点击头像
 */
- (void)homePageTableViewHitHeadAction:(CTHomePageTableView *)cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(hitHeadAction:withItem:)]) {
        [self.delegate hitHeadAction:self withItem:item];
    }
}
/**
 *@brief 点击大图
 */
- (void)homePageTableViewHitPicImageBtnAction:(CTHomePageTableView *)cell withItem:(CTHotSpotsDetailItem *)item withImageView:(UIImageView *)picImageView
{
    if ([self.delegate respondsToSelector:@selector(hitPicImageBtnAction:withItem:withImageView:)]) {
        [self.delegate hitPicImageBtnAction:self withItem:item withImageView:picImageView];
    }
}
/**
 *@brief 点赞
 */
- (void)homePageTableViewHitFavourBtnAction:(CTHomePageTableView *)cell withItem:(CTHotSpotsDetailItem *)item withBool:(BOOL) favBool
{
    if ([self.delegate respondsToSelector:@selector(hitFavourBtnAction:withItem:withBool:)]) {
        [self.delegate hitFavourBtnAction:self withItem:item withBool:favBool];
    }
}
/**
 *@brief 点击评论按钮
 */
- (void)homePageTableViewHitCommentBtnaction:(CTHomePageTableView *) cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(hitCommentBtnaction:withItem:)]) {
        [self.delegate hitCommentBtnaction:self withItem:item];
    }
}
/**
 *@brief 点击分享按钮
 */
- (void)homePageTableViewHitShareBtnAction:(CTHomePageTableView *) cell withItem:(CTHotSpotsDetailItem *)item withImage:(UIImage *)img
{
    if ([self.delegate respondsToSelector:@selector(hitShareBtnAction:withItem:withImage:)]) {
        [self.delegate hitShareBtnAction:self withItem:item withImage:img];
    }
}
/**
 *@brief 点击更多按钮
 */
- (void)homePageTableViewHitMoreBtnAction:(CTHomePageTableView *) cell withItem:(CTHotSpotsDetailItem *)item
{
    if ([self.delegate respondsToSelector:@selector(hitMoreBtnAction:withItem:)]) {
        [self.delegate hitMoreBtnAction:self withItem:item];
    }
}
/**
 *@brief 点击点赞的人的头像
 */
- (void)homePageTableViewHitFavBtnHeadAction:(CTHomePageTableView *)cell withItem:(CTListDetailUser *)item
{
    if ([self.delegate respondsToSelector:@selector(hitFavBtnHeadAction:withItem:)]) {
        [self.delegate hitFavBtnHeadAction:self withItem:item];
    }
}
/**
 *@brief 点击关注按钮
 */
- (void)homePageTableViewHitAttentionBtnAction:(CTHomePageTableView *)cell withItem:(CTHotSpotsDetailItem *)item withBool:(BOOL)attenBool
{
    if ([self.delegate respondsToSelector:@selector(hitAttentionBtnAction:withItem:withBool:)]) {
        [self.delegate hitAttentionBtnAction:self withItem:item withBool:attenBool];
    }
}
/**
 *@brief 点击话题
 */
- (void)homePageTableViewHitTopicBtnAction:(CTHomePageTableView *) cell withItem:(CTTopic *)item
{
    if ([self.delegate respondsToSelector:@selector(hitTopicBtnAction:withItem:)]) {
        [self.delegate hitTopicBtnAction:self withItem:item];
    }
}




@end
